package com.ruoyi.web.controller.net;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.net.domain.BusiL2VpnQoslevel;
import com.ruoyi.net.service.IBusiL2VpnQoslevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 业务-L2 VPN qos上下话优先级Controller
 * 
 * @author net
 * @date 2024-12-15
 */
@Api(tags = "业务-L2 VPN qos上下话优先级")
@RestController
@RequestMapping("/busi/l2/vpn/qoslevel")
public class BusiL2VpnQoslevelController extends BaseController
{
    @Autowired
    private IBusiL2VpnQoslevelService busiL2VpnQoslevelService;

    /**
     * 查询业务-L2 VPN qos上下话优先级列表
     */
    @ApiOperation(value = "查询业务-L2 VPN qos上下话优先级列表", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusiL2VpnQoslevel busiL2VpnQoslevel)
    {
        startPage();
        List<BusiL2VpnQoslevel> list = busiL2VpnQoslevelService.selectBusiL2VpnQoslevelList(busiL2VpnQoslevel);
        return getDataTable(list);
    }

    /**
     * 导出业务-L2 VPN qos上下话优先级列表
     */
    @ApiOperation(value = "导出业务-L2 VPN qos上下话优先级列表", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:export')")
    @Log(title = "业务-L2 VPN qos上下话优先级", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusiL2VpnQoslevel busiL2VpnQoslevel)
    {
        List<BusiL2VpnQoslevel> list = busiL2VpnQoslevelService.selectBusiL2VpnQoslevelList(busiL2VpnQoslevel);
        ExcelUtil<BusiL2VpnQoslevel> util = new ExcelUtil<BusiL2VpnQoslevel>(BusiL2VpnQoslevel.class);
        util.exportExcel(response, list, "业务-L2 VPN qos上下话优先级数据");
    }

    /**
     * 获取业务-L2 VPN qos上下话优先级详细信息
     */
    @ApiOperation(value = "获取业务-L2 VPN qos上下话优先级详细信息", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busiL2VpnQoslevelService.selectBusiL2VpnQoslevelById(id));
    }

    /**
     * 新增业务-L2 VPN qos上下话优先级
     */
    @ApiOperation(value = "新增业务-L2 VPN qos上下话优先级", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:add')")
    @Log(title = "业务-L2 VPN qos上下话优先级", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusiL2VpnQoslevel busiL2VpnQoslevel)
    {
        return toAjax(busiL2VpnQoslevelService.insertBusiL2VpnQoslevel(busiL2VpnQoslevel));
    }

    /**
     * 修改业务-L2 VPN qos上下话优先级
     */
    @ApiOperation(value = "修改业务-L2 VPN qos上下话优先级", httpMethod = "PUT")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:edit')")
    @Log(title = "业务-L2 VPN qos上下话优先级", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusiL2VpnQoslevel busiL2VpnQoslevel)
    {
        return toAjax(busiL2VpnQoslevelService.updateBusiL2VpnQoslevel(busiL2VpnQoslevel));
    }

    /**
     * 删除业务-L2 VPN qos上下话优先级
     */
    @ApiOperation(value = "删除业务-L2 VPN qos上下话优先级", httpMethod = "DELETE")
    @PreAuthorize("@ss.hasPermi('net:qoslevel:remove')")
    @Log(title = "业务-L2 VPN qos上下话优先级", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busiL2VpnQoslevelService.deleteBusiL2VpnQoslevelByIds(ids));
    }
}
